<template>
	<view>
		<view class="top flexs">
			<view class="flexs">
				<image @click="touser" class="head" :src="usermsg.avatar? usermsg.avatar:'../../static/image/bg_img.png'"></image>
				<view class="topa_right">
					<view class="name flexs">{{usermsg.nickname}}<image class="vip" src="../../static/image/v.png" v-if="usermsg.level==1"></image></view>
					<view class="stus">ID:{{usermsg.idnum}}</view>
					<!-- <view class="stus" v-else>开通VIP</view> -->
				</view>
			</view>
			<view class="flexs" @click="myCode">
				<image class="erweima" src="../../static/image/erweima_31.png"></image>
				<image class="fanhui" src="../../static/image/fanhui_21.png"></image>
			</view>
		</view>
		<view class="content">
			<view class="list flexs" @click="friendCircle">
				<view class="lista flexs">
					<image class="icons" src="../../static/image/pyouquan_50.png"></image>
					<view>朋友圈</view>
				</view>
				<image class="fanhui" src="../../static/image/fanhui_21.png"></image>
			</view>
			<view class="list flexs" @click="collection">
				<view class="lista flexs">
					<image class="icons" src="../../static/image/shoucang_40.png"></image>
					<view>收藏</view>
				</view>
				<image class="fanhui" src="../../static/image/fanhui_21.png"></image>
			</view>
			<view class="list flexs" @click="vip">
				<view class="lista flexs">
					<image class="icons iconsa" src="../../static/image/vip_40.png"></image>
					<view>VIP推广</view>
				</view>
				<image class="fanhui" src="../../static/image/fanhui_21.png"></image>
			</view>
			<view class="list flexs" @click="set">
				<view class="lista flexs">
					<image class="icons" src="../../static/image/shezhi_50.png"></image>
					<view>设置</view>
				</view>
				<image class="fanhui" src="../../static/image/fanhui_21.png"></image>
			</view>
			<view class="list flexs" @click="help">
				<view class="lista flexs">
					<image class="icons" src="../../static/image/bangzhu_40.png"></image>
					<view>帮助</view>
				</view>
				<image class="fanhui" src="../../static/image/fanhui_21.png"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				usermsg: [],
				showMask:'',
				avatar: uni.getStorageSync('noavatar')
			}
		},
		onShow(){
			this.$msgchat.initwork();
			this.initdata();
			
		},
		onBackPress() {
		   if(this.showMask) {  
		     this.showMask = false;  
		     return true;  
		   }else{  
		      uni.showModal({  
		        title: '提示',  
		        content: '是否退出应用?',  
		        success: function(res) {  
		            if (res.confirm) {  
		                // 退出当前应用，改方法只在App中生效  
		                plus.runtime.quit();  
						uni.closeSocket({
							success:(res)=>{
								console.log(res)
							}
						})
		            } else if (res.cancel) {  
		                console.log('用户点击取消');  
		            }  
		        }  
		      });  
		      return true  
		   }  
		},
		methods: {
			initdata(){
				var obj = {
					token: uni.getStorageSync('token'),
				}
				// console.log(obj);return false;
				this.$common.requests('/api/Group/checkmyvip', obj).then(res => {
					if(res.data.code==1){
						if(res.data.data.avatar){
							res.data.data.avatar = this.$common.baseUrl + res.data.data.avatar;
						}
						this.usermsg = res.data.data;
					}else{
						this.$api.msg(res.data.msg);
						return;
					}
					
				})
			},
			//我的二维码
			myCode(){
				uni.navigateTo({
					url:'../myCode/myCode'
				})
			},
			//我的二维码
			collection(){
				uni.navigateTo({
					url:'../collection/collection'
				})
			},
			//个人信息
			touser(){
				uni.navigateTo({
					url: '/pages/set/userInformation/userInformation'
				})
			},
			//朋友圈
			friendCircle(){
				uni.navigateTo({
					url:'../friendCircle/friendCircle'
				})
			},
			//设置
			set(){
				uni.navigateTo({
					url:'../set/set'
				})
			},
			//帮助
			help(){
				uni.navigateTo({
					url:'../set/child/help'
				})
			},
			vip(){
				uni.navigateTo({
					url:'../vip/vip'
				})
			}
		}
	}
</script>

<style>
page{
}
.top{
	width: 100%;
	padding:90upx 30upx 30upx 30upx!important;
	justify-content: space-between!important;
}
.flexs{
	display: flex;
	justify-content: flex-start;
	align-items: center;
}
.head{
	width: 120upx;
	height: 120upx;
	border-radius: 50%;
}
.topa_right{
	padding-left: 20upx;
}
.erweima{
	width: 40upx;
	height: 40upx;
	margin-right: 15upx;
}
.stus{
	color: #C7C5C5;
	font-size: 28upx;
	padding-top: 15upx;
}
.vip{
	width: 35upx;
	height: 30upx;
	margin: 0 15upx;
}
.content{
	background: #FFF;
	padding: 30upx;
	border-top: 25upx solid #F5F4F9;
}
.list{
	padding: 40upx 0;
	justify-content: space-between!important;
	border-bottom: 1px solid #F5F4F9;
}
.icons{
	width: 45upx;
	height: 45upx;
	margin-right: 25upx;
}
.iconsa{
	height: 40upx;
}
.fanhui {
		width: 20upx;
		height: 30upx;
	}
	.contenta{
		margin-top: 25upx;
	}
	.bold{
		font-weight: 600;
	}
	.reds{
		color: #F01C52;
		font-size: 30upx;
	}
	.btns{
		width: 100%;
		height: 80upx;
		margin-top: 20upx;
	}
</style>
